<?php $this->load->view('layout/header'); ?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li>商品管理</li>
            <li><a href="<?php echo site_url('tourismgoodsbase/grid');?>">宝贝管理</a></li>
            <li class="active"><a href="<?php echo site_url('tourismgoodsbase/images/'.$goods_id);?>">图片管理</a></li>
        </ul>
        <?php echo execute_alert_message(); ?>
        <div class="order-search">
            <form class="form-horizontal public-validate-form" action="<?php echo site_url('tourismgoodsbase/saveImages'); ?>" method="post" enctype="multipart/form-data">
                <div class="row search-button">
                    <div class="col-lg-9">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">上传图片</label>
                            <div class="col-xs-9">
                                <input type="hidden" name="goods_id" value="<?php echo $goods_id ?>"/>
                                <input type="file" name="goods_image" class="checkPicture required">
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-3">
                        <div class="form-group">
                            <label class="col-sm-8 control-label"> </label>
                            <div class="col-xs-4">
                                <button type="submit" class="btn btn-warning">上传</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="add-product">
            <div class="fonter">图片管理</div>
            <?php if ($images->num_rows() > 0) : ?>
                <?php $i = 1; foreach ($images->result() as $val) : ?>
                    <?php if (($i - 1) % 4 == 0) : ?><div class="row"><?php endif; ?>
                    <div class="col-xs-3">
                        <div class="thumbnail">
                            <a target="_blank" href="<?php echo $this->config->show_image_url($val->images); ?>">
                                <img class="img-rounded lazy" src="skins/images/load.jpg" data-original="<?php echo $this->config->show_image_url($val->images); ?>" style="width:160px;height:160px;">
                            </a>
                            <div class="thumbnail-operate">
                                <a href="<?php echo site_url('tourismgoodsbase/deleteImage/'.$val->id).'?goods_id='.$val->goods_id; ?>" onclick="return confirm('确定要删除？')">删除</a>
                                <?php if($val->is_main == 0):?>
                                    <a href="<?php echo site_url('tourismgoodsbase/mainImage/'.$val->id).'?goods_id='.$val->goods_id; ?>" onclick="return confirm('确定要设为默认值？')">设为默认</a>
                                <?php endif;?>
                            </div>
                        </div>
                    </div>
                    <?php if ($i % 4 == 0 || $i == $images->num_rows()) : ?></div><?php endif; ?>
                <?php $i++;endforeach ?>
            <?php endif ?>
        </div>
    </div>
</div>
<script type="text/javascript">
$('.public-validate-form').validate();
</script>
<?php $this->load->view('layout/footer'); ?>